package com.yxs.testfeign.controller;

import com.yxs.test.model.dto.UserDto;
import com.yxs.test.model.dto.UserResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@Api("测试feign")
@RequestMapping("test-feign-service")
public class IndexController {

    @GetMapping("test")
    public UserResult testFeignApi(UserDto userDto) {
        UserResult userResult = new UserResult();
        userResult.setUserName("返回成功:" + userDto.getUserName());
        userResult.setAge(userDto.getAge());
        int i = 1/0;
        return userResult;
    }

    @GetMapping("testMapForGet")
    public UserResult testMap(@RequestParam Map<String,Object> userMap) {
        UserResult userResult = new UserResult();
        userResult.setUserName("返回成功:" + userMap.get("userName"));
        userResult.setAge(111);
        return userResult;
    }
}
